<?php
namespace app\easyreportphp\controller;
use app\easyreportphp\Model\MetaReport as MetaReportModel;
use \think\Request; 
use easyreportphplib\form\QueryParamFormView;
use easyreportphplib\form\AbstractQueryParamFormView;
use easyreportphplib\form\EasyUIQueryFormView;
use easyreportphplib\form\HtmlCheckBox;
use easyreportphplib\form\HtmlCheckBoxList;
use easyreportphplib\form\HtmlComboBox;
use easyreportphplib\form\HtmlDateBox;
use easyreportphplib\form\HtmlFormElement;
use easyreportphplib\form\HtmlSelectOption;
use easyreportphplib\form\HtmlTextBox;
use easyreportphplib\form\ReportHelper;

class Report extends Base
{
    public function main()
    {    
		$uid = Request::instance()->param('uid');
		$report = MetaReportModel::get(['uid' => $uid]);
		$this->assign("report",$report);
        return $this->fetch('main');
    } 
	public function table()
    {   
		
		if(!empty(Request::instance()->param('getDate')))
		{
			 echo '';
		}else
		{
			$uid = Request::instance()->param('uid');
			$report = MetaReportModel::get(['uid' => $uid]);	
			$reportHelper = new ReportHelper();
			$requestData = Request::instance()->param();
			
			$ret = $reportHelper->renderByTemplate($uid,$report,$requestData);
			//var_dump($ret );
			$this->assign("id",$ret["id"]);
			$this->assign("name",$ret["name"]);
			$this->assign("uid",$ret["uid"]);
			$this->assign("statColumHtmlText",$ret["statColumHtmlText"]);
			$this->assign("nonStatColumHtmlText",$ret["nonStatColumHtmlText"]);
			$this->assign("htmlTable","");//TODO
			$this->assign("formHtmlText",$ret["formHtmlText"]);
			 
			/*
			$txtBox = new HtmlTextBox('testtxt','testxt','test');
			$EasyUI = new EasyUIQueryFormView();
			echo $EasyUI->getTexBoxText($txtBox);*/
			echo $this->fetch('report\themes\content\table');
		}
		
	} 
	public function tablegetdatajson()
	{
		$arr = [];
		echo '';
	}
	public function chart()
    {   
		$uid = Request::instance()->param('uid');
		$report = MetaReportModel::get(['uid' => $uid]);	
		$this->assign("id",$report->id);
		$this->assign("name",$report->name);
		$this->assign("uid",$report->uid);
		$this->assign("statColumHtmlText",$report->uid);
		$this->assign("htmlTable",$report->uid); 
		$this->assign("formHtmlText",$report->uid);
		$this->assign("nonStatColumHtmlText",$report->uid);
		$this->assign("message",$report->uid);
        echo  $this->fetch('report\themes\content\chart');
    } 
}